package com.xltt.watchserver;

import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Log;

import com.xltt.watchserver.utils.Logger;

import static android.content.Context.TELEPHONY_SERVICE;

public class BootCompletedReceiver extends BroadcastReceiver {

    public static final String BLE_NAME = "ble_name";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("BootCompletedReceiver", "Bevis add for BootCompletedReceiver");
        String action = intent.getAction();
        if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
            //Intent newIntent = new Intent(context, MainActivity.class);
            //newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//注意，必须添加这个标记，否则启动会失败
            //context.startActivity(newIntent);
            context.startService(new Intent(context, WatchService.class));
        }
    }

}
